home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / FixMath.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  3.5 KB  |  145 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        FixMath.p
  3.  
  4.      Contains:    Fixed Math Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT FixMath;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __FIXMATH__}
  30. {$SETC __FIXMATH__ := 1}
  31.  
  32. {$I+}
  33. {$SETC FixMathIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. CONST
  47.     fixed1                        = $00010000;
  48.     fract1                        = $40000000;
  49.     positiveInfinity            = $7FFFFFFF;
  50.     negativeInfinity            = $80000000;
  51.  
  52.  
  53. FUNCTION Fix2Frac(x: Fixed): Fract;
  54.     {$IFC NOT GENERATINGCFM}
  55.     INLINE $A841;
  56.     {$ENDC}
  57. FUNCTION Fix2Long(x: Fixed): LONGINT;
  58.     {$IFC NOT GENERATINGCFM}
  59.     INLINE $A840;
  60.     {$ENDC}
  61. FUNCTION Long2Fix(x: LONGINT): Fixed;
  62.     {$IFC NOT GENERATINGCFM}
  63.     INLINE $A83F;
  64.     {$ENDC}
  65. FUNCTION Frac2Fix(x: Fract): Fixed;
  66.     {$IFC NOT GENERATINGCFM}
  67.     INLINE $A842;
  68.     {$ENDC}
  69. FUNCTION FracMul(x: Fract; y: Fract): Fract;
  70.     {$IFC NOT GENERATINGCFM}
  71.     INLINE $A84A;
  72.     {$ENDC}
  73. FUNCTION FixDiv(x: Fixed; y: Fixed): Fixed;
  74.     {$IFC NOT GENERATINGCFM}
  75.     INLINE $A84D;
  76.     {$ENDC}
  77. FUNCTION FracDiv(x: Fract; y: Fract): Fract;
  78.     {$IFC NOT GENERATINGCFM}
  79.     INLINE $A84B;
  80.     {$ENDC}
  81. FUNCTION FracSqrt(x: Fract): Fract;
  82.     {$IFC NOT GENERATINGCFM}
  83.     INLINE $A849;
  84.     {$ENDC}
  85. FUNCTION FracSin(x: Fixed): Fract;
  86.     {$IFC NOT GENERATINGCFM}
  87.     INLINE $A848;
  88.     {$ENDC}
  89. FUNCTION FracCos(x: Fixed): Fract;
  90.     {$IFC NOT GENERATINGCFM}
  91.     INLINE $A847;
  92.     {$ENDC}
  93. FUNCTION FixATan2(x: LONGINT; y: LONGINT): Fixed;
  94.     {$IFC NOT GENERATINGCFM}
  95.     INLINE $A818;
  96.     {$ENDC}
  97. {$IFC GENERATINGPOWERPC }
  98. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  99. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): WidePtr; C;
  100. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): WidePtr; C;
  101. FUNCTION WideNegate(VAR target: wide): WidePtr; C;
  102. FUNCTION WideShift(VAR target: wide; shift: LONGINT): WidePtr; C;
  103. FUNCTION WideSquareRoot({CONST}VAR source: wide): LONGINT; C;
  104. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): WidePtr; C;
  105. { returns the quotient }
  106. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  107. { quotient replaces dividend }
  108. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): WidePtr; C;
  109. FUNCTION WideBitShift(VAR src: wide; shift: LONGINT): WidePtr; C;
  110. {$ENDC}
  111. {$IFC GENERATING68K  & NOT GENERATING68881 }
  112. FUNCTION Frac2X(x: Fract): double_t;
  113.     {$IFC NOT GENERATINGCFM}
  114.     INLINE $A845;
  115.     {$ENDC}
  116. FUNCTION Fix2X(x: Fixed): double_t;
  117.     {$IFC NOT GENERATINGCFM}
  118.     INLINE $A843;
  119.     {$ENDC}
  120. FUNCTION X2Fix(x: double_t): Fixed;
  121.     {$IFC NOT GENERATINGCFM}
  122.     INLINE $A844;
  123.     {$ENDC}
  124. FUNCTION X2Frac(x: double_t): Fract;
  125.     {$IFC NOT GENERATINGCFM}
  126.     INLINE $A846;
  127.     {$ENDC}
  128. {$ELSEC}
  129. FUNCTION Frac2X(x: Fract): double_t;
  130. FUNCTION Fix2X(x: Fixed): double_t;
  131. FUNCTION X2Fix(x: double_t): Fixed;
  132. FUNCTION X2Frac(x: double_t): Fract;
  133. {$ENDC}
  134.  
  135. {$ALIGN RESET}
  136. {$POP}
  137.  
  138. {$SETC UsingIncludes := FixMathIncludes}
  139.  
  140. {$ENDC} {__FIXMATH__}
  141.  
  142. {$IFC NOT UsingIncludes}
  143.  END.
  144. {$ENDC}
  145.